package Messages;

import Agents.Messageable;

public class NotUnderstoodMessage extends AMessage
{
	private static final String ErrorMessageSplitter = " did not understand: ";
	private static final String ErrorSender = " from ";
	
	public MessageType notUnderstood;
	public String from;
	
	protected String constructSpecialMessage(Messageable agent) 
	{
		return null;
	}
	
	public static String constructSpecialMessage(Messageable agent, AMessage am)
	{
		return MessageType.DEFAULT + messageSplit + agent.getLocalName() + ErrorMessageSplitter + am.getMessageType().get() + ErrorSender + am.getSender();
		
	}

	protected String constructSpecialMessage(Messageable agent,	MessageType type) 
	{
		return null;
	}

	@Override
	protected void retrieveMyMessage(String theMessage) 
	{
		String[] something = theMessage.split(ErrorMessageSplitter);
		sender = something[0];
		
		something = something[1].split(ErrorSender);
		notUnderstood = MessageType.decode(something[0]);
		from = something[1];
	}
	
	@SuppressWarnings("serial")
	class MethodNotNeededException extends Exception
	{
		
	}
	
}
